package com.xsg.printer.core;

import com.xsg.printer.core.conditions.ElementConfig;
import com.xsg.printer.core.conditions.TemplateStepConfig;
import com.xsg.printer.core.enums.*;
import com.xsg.printer.core.model.*;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

public class VoucherTestTemplate {

    /**
     * 模板测试1
     * @return
     */
    public static XsgTemplate template1() {
        return TemplateStepConfig.builder().body(800, 800)
                .div(300, 200, FloatAlignEnum.RIGHT, divConfig -> divConfig
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT, ElementConfig.builder()
                                        .qrCode("888888888", 50, 50)
                                        .build()
                                )
                                .div(100, 50, FloatAlignEnum.RIGHT)
                        )
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT)
                                .div(100, 50, FloatAlignEnum.RIGHT)
                        )
                )
                .div(300, 200, FloatAlignEnum.NONE, divConfig -> divConfig
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT)
                                .div(100, 50, FloatAlignEnum.RIGHT)
                        )
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT)
                                .div(100, 50, FloatAlignEnum.RIGHT)
                        )
                )
                .div(300, 200, FloatAlignEnum.LEFT, divConfig -> divConfig
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT)
                                .div(100, 50, FloatAlignEnum.RIGHT)
                        )
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT)
                                .div(100, 50, FloatAlignEnum.RIGHT)
                        )
                )
                .div(300, 200, FloatAlignEnum.NONE, divConfig -> divConfig
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT)
                                .div(100, 50, FloatAlignEnum.RIGHT)
                        )
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT)
                                .div(100, 50, FloatAlignEnum.RIGHT)
                        )
                )
                .div(300, 200, FloatAlignEnum.RIGHT, divConfig -> divConfig
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT)
                                .div(100, 50, FloatAlignEnum.RIGHT)
                        )
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT)
                                .div(100, 50, FloatAlignEnum.RIGHT)
                        )
                )
                .div(300, 200, FloatAlignEnum.RIGHT, divConfig -> divConfig
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT, ElementConfig.builder()
                                        .text("wqwq",  100, 50)
                                        .build()
                                )
                                .div(100, 50, FloatAlignEnum.RIGHT)
                        )
                        .div(200, 100, FloatAlignEnum.RIGHT, divConfig1 -> divConfig1
                                .div(100, 50, FloatAlignEnum.RIGHT, ElementConfig.builder()
                                        .qrCode("89885", 50, 50, AlignEnum.TOP_RIGHT)
                                        .build()
                                )
                                .div(100, 50, FloatAlignEnum.RIGHT, ElementConfig.builder()
                                        .text("wqwq",  100, 50)
                                        .build()
                                )
                        )
                )
                .build();
    }

    public static XsgTemplate template2() {
        return TemplateStepConfig.builder().body(800, 800)
                .div(400, 800, FloatAlignEnum.LEFT, ElementConfig.builder()
                        .qrCode("89885", 200, 200, AlignEnum.CENTER)
                        .build()
                )
                .div(400, 800, FloatAlignEnum.LEFT, ElementConfig.builder()
                        .qrCode("89885", 200, 200, AlignEnum.TOP_RIGHT)
                        .qrCode("89885", 200, 200, AlignEnum.TOP_RIGHT)
                        .qrCode("89885", 200, 200, AlignEnum.TOP_RIGHT)
                        .qrCode("89885", 200, 200, AlignEnum.TOP_LEFT)
                        .build()
                )
                .build();
    }

    public static XsgTemplate template3() {
        return TemplateStepConfig.builder().body(800, 800)
                .div(400, 800, FloatAlignEnum.LEFT, ElementConfig.builder()
                        .qrCode("89885", 200, 200, AlignEnum.TOP_RIGHT, new XsgMargin().setTop(15))
                        .barCode("89885", 100, 100, AlignEnum.TOP_RIGHT, new XsgMargin().setTop(15))
                        .qrCode("89885", 200, 200, AlignEnum.TOP_RIGHT, new XsgMargin().setTop(15))
                        .circle("收", 30, 30, AlignEnum.TOP_RIGHT, new XsgMargin().setTop(15).setRight(10), new XsgFont().setFontFamily(FontFamilyEnum.BOLD).setFontSize(FontSizeEnum.MEDIUM).setColor(ColorEnum.BLACK).setAlign(AlignEnum.CENTER))
                        .build()
                )
                .div(400, 800, FloatAlignEnum.LEFT, ElementConfig.builder()
                        .qrCode("https://xt-wms-prod.oss-cn-shenzhen.aliyuncs.com/A467DB36136ED9B66C820F150A7193E4.jpg", 200, 200, AlignEnum.TOP_RIGHT)
                        .image("D:\\work\\docs\\images\\2022.png", 100, 100, new XsgMargin().setTop(10))
                        .image("D:\\work\\docs\\images\\2022.png", 100, 100, AlignEnum.TOP_LEFT, new XsgMargin().setTop(10).setLeft(200))
                        .imageR("https://xt-wms-prod.oss-cn-shenzhen.aliyuncs.com/A467DB36136ED9B66C820F150A7193E4.jpg", 200, 200, AlignEnum.TOP_LEFT)
                        .build()
                )
                .build();
    }

    public static XsgTemplate template4() {
        return TemplateStepConfig.builder().body(800, 800)
                .div(400, 800, FloatAlignEnum.LEFT, ElementConfig.builder()
                        .qrCode("qrCode", 200, 200, AlignEnum.TOP_RIGHT, new XsgMargin().setTop(15))
                        .build()
                )
                .div(400, 800, FloatAlignEnum.LEFT, ElementConfig.builder()
                        .image("localImagePath", 100, 100, new XsgMargin().setTop(100).setLeft(10))
                        .barCode("qrCode", 400, 50, AlignEnum.TOP_LEFT, new XsgMargin().setTop(10).setLeft(10))
                        .text("text", 100, 100, new XsgFont().setFontFamily(FontFamilyEnum.BOLD).setFontStyle(FontStyleEnum.NORMAL).setFontSize(FontSizeEnum.MEDIUM).setColor(ColorEnum.BLACK).setNeedFeedLine(false))
                        .text("text", 100, 100, AlignEnum.LR_CENTER,  new XsgMargin().setTop(0).setLeft(10))
                        .build()
                )
                .build();
    }

    public static XsgTemplate template5() {
        return TemplateStepConfig.builder().body(800, 800)
                .div(400, 800, FloatAlignEnum.LEFT, ElementConfig.builder()
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.SMALL_XX).setAlign(AlignEnum.TOP_RIGHT))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.SMALL_X).setAlign(AlignEnum.TOP_RIGHT))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.SMALL).setAlign(AlignEnum.TOP_RIGHT))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.MEDIUM).setAlign(AlignEnum.TOP_RIGHT))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.LARGE).setAlign(AlignEnum.TOP_RIGHT))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.LARGE_X).setAlign(AlignEnum.TOP_RIGHT))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.LARGE_XX).setAlign(AlignEnum.TOP_RIGHT))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.LARGE_XXX).setAlign(AlignEnum.TOP_RIGHT))
                        .build()
                )
                .build();
    }

    public static XsgTemplate template6() {
        return TemplateStepConfig.builder().body(800, 800)
                .div(400, 800, FloatAlignEnum.LEFT, XsgBorder.hiddenBorder().setTopStyle(BorderStyleEnum.FULL).setBottomStyle(BorderStyleEnum.WAVE).setLeftStyle(BorderStyleEnum.WAVE).setColor(ColorEnum.BLACK), ElementConfig.builder()
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.SMALL_XX).setAlign(AlignEnum.CENTER))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.SMALL_X).setAlign(AlignEnum.CENTER))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.SMALL).setAlign(AlignEnum.CENTER))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.MEDIUM).setAlign(AlignEnum.CENTER))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.LARGE).setAlign(AlignEnum.CENTER))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.LARGE_X).setAlign(AlignEnum.CENTER))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.LARGE_XX).setAlign(AlignEnum.CENTER))
                        .text("text1", 400, 50, AlignEnum.TOP_RIGHT,  XsgFont.defaultFont().setFontSize(FontSizeEnum.LARGE_XXX).setAlign(AlignEnum.CENTER))
                        .build()
                )
                .build();
    }

    public static XsgTemplate template7() {
        return TemplateStepConfig.builder().body(800, 800)
                .div(400, 800, FloatAlignEnum.LEFT, XsgBorder.hiddenBorder().setTopStyle(BorderStyleEnum.NONE).setBottomStyle(BorderStyleEnum.NONE).setLeftStyle(BorderStyleEnum.NONE).setColor(ColorEnum.BLACK), ElementConfig.builder()
                        .sheet("sheetList", 200, 400, XsgSheet.instance().setHeaders(new String[]{"列1", "列2"}).setCellWidth(70).setCellHeight(30), AlignEnum.TOP_LEFT, XsgFont.defaultFont().setFontSize(FontSizeEnum.SMALL).setAlign(AlignEnum.CENTER))
                        .build()
                )
                .build();
    }

    public static TemplateVo4 getTemplateVo() {
        TemplateVo4 templateVo4 = new TemplateVo4();
        templateVo4.setQrCode("222222222222");
        templateVo4.setLocalImagePath("D:\\work\\docs\\images\\2022.png");
        templateVo4.setRemoteImagePath("https://xt-wms-prod.oss-cn-shenzhen.aliyuncs.com/A467DB36136ED9B66C820F150A7193E4.jpg");
        templateVo4.setText("我撒凯撒就是纠结撒计算机萨卡拉萨市了");
        templateVo4.setText1("我是谁的谁谁睡睡");
        List<List<String>> row = new ArrayList<>();
        List<String> cells1 = new ArrayList<>();
        cells1.add("值1");
        cells1.add("值211111");
        row.add(cells1);
        List<String> cells2 = new ArrayList<>();
        cells2.add("值221");
        cells2.add("值211111飒飒飒飒飒飒飒飒飒飒是");
        row.add(cells2);
        templateVo4.setSheetList(row);
        return templateVo4;
    }

    @Data
    public static class TemplateVo4 {
        private String qrCode;
        private String localImagePath;
        private String remoteImagePath;
        private String text;
        private String text1;
        private List<List<String>> sheetList;
    }
}
